home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CD32 / CD32_Support / examples / SA_Examples / nonvolatile / overload.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-08-31  |  1.3 KB  |  58 lines

  1. /* see what happens when you overstress nv-lib */
  2.  
  3. parse arg items bytes nvpro clean .
  4.  
  5. signal on break_c
  6.  
  7. i = 0
  8. bytes = strip(bytes)
  9. items = strip(items)
  10. nvpro = strip(nvpro)
  11. clean = strip(clean)
  12.  
  13. usage = "overload <numberOfItems> <bytesPerItem> [protect] [clean]"
  14.  
  15. /* we MUST know how many items to deal with */
  16. if (datatype(items) ~= 'NUM') then do
  17.     say "non-numeric items:" items
  18.     say usage
  19.     exit 10
  20. end
  21.  
  22. /* allow usage of "overload 3 clean" and variants, too */
  23. if (((clean ~= '') & (upper(clean) ~= 'PROTECT')) | (upper(nvpro) = 'CLEAN') | (upper(bytes) = 'CLEAN')) then do
  24.     say "Erasing items 1 to" items "owned by Overload."
  25.     do i = 1 to items
  26.         address command 'setnvprotection' 'name Overload item test' || i 'flags 0x00'
  27.         address command 'deletenv' 'name Overload item test' || i 
  28.     end
  29.     exit 0
  30. end
  31.  
  32. /* deal with args */
  33. if (datatype(bytes) ~= 'NUM') then do
  34.     say usage
  35.     exit 10
  36. end
  37. if nvpro = '' then
  38.     nvpro = 0
  39. else
  40.     nvpro = 1
  41.  
  42. do i = 1 to items
  43.     address command 'storenv' 'name Overload item test' || i 'bufsize' bytes 'buffill 65'
  44.     if (nvpro) then
  45.         address command 'setnvprotection' 'name Overload item test' || i 'flags 0x01'
  46. end
  47.  
  48.  
  49.  
  50. exit
  51.  
  52. break_c:
  53.     say "Last item was" i || ".  Goodbye."
  54.     exit
  55. return
  56.  
  57.  
  58.